
import http from "@/utils/ajax/http"

const api = {
    code:{
        OK:0    },
    user:{
        login:'authLogin.do?ac=login',
        tokenLogin:'tokenLogin',
        logout: 'logout.do'
    },
    checkUpdate:'sh.do',
    editorPassword :'editPassword',
    checkField:'checkno.do',
    payment:'payment.do',
    collect:'collect.do',
    shoucangjilu: {
        listusername:"shoucangjilu_list2.do",
        delete:'shoucangjilu_delete'
    },
    captch(){
        var url = "captcha?rd="+Math.floor(Math.random()*100000);
        return new Promise((resolve, reject) => {
            http.get( url ).then(res=>{
                var url = res.data;
                resolve(url);
            },reject);
        });
    },
    search:{
        select:'selectUpdateSearch',
        table:'tableAjax?a=table',
        selectView:'selectView',
        all:'selectAll'
    },
    attachment:{
        uploadUrl:'upload_re.do',
        upload (file) {
            return new Promise((resolve, reject) => {
                var formdata = new FormData();
                formdata.append("fujian" , file , file.name || 'tmp.png');
                http.post(api.attachment.uploadUrl , formdata)
                    .then(res=>{
                        if(res.code == api.code.OK)
                        {
                            resolve(res.data);
                        }else{
                            reject(res.msg);
                        }
                    }).catch(err=>{
                        reject(err.message);
                    });
            });
        },
    },
    // 找到后端的相应的类,运行相应的功能.
    admins:{
            list:"admins_list",
            edit:"admins_updt",
            update:"admins_update",
            delete:"admins_delete",
            insert:"admins_insert",
            detail:"admins_detail",
            create:"admins_add",
        },
    yonghu:{
            list:"yonghu_list",
            edit:"yonghu_updt",
            delete:"yonghu_delete",
            insert:"yonghu_insert",
            update:"yonghuupdate",
            detail:"yonghu_detail",
            create:"yonghu_add",

        },
    jingdianxinxi:{
        create:"jingdianxinxi_add",
        insert:"jingdianxinxi_insert",
        update:"jingdianxinxiupdate",
        list:"jingdianxinxi_list",
        detail:"jingdianxinxi_detail",
        edit:"jingdianxinxi_updt",
        delete:"jingdianxinxi_delete",
        weblist:"jingdianxinxilist",
        webdetail:"jingdianxinxidetail",
    },
    diqu:{
        list:"diqu_list",
        insert:"diquinsert",
        update:"diquupdate",
        delete:"diqu_delete",
        detail:"diqu_detail",
        create:"diqu_add",
        edit:"diqu_updt",
    },
    news:{
        list:"xinwenxinxi_list",
        insert:"xinwenxinxiinsert",
        update:"xinwenxinxiupdate",
        delete:"xinwenxinxi_delete",
        detail:"xinwenxinxi_detail",
        create:"xinwenxinxi_add",
        edit:"xinwenxinxi_updt",
        listtianjiaren:"xinwenxinxi_list_tianjiaren",
        weblist:"xinwenxinxilist",
        webdetail:"xinwenxinxidetail",
    },
    news_information:{
            list:"xinwenfenlei_list",
            insert:"xinwenfenleiinsert",
            update:"xinwenfenleiupdate",
            delete:"xinwenfenlei_delete",
            detail:"xinwenfenlei_detail",
            create:"xinwenfenlei_add",
            edit:"xinwenfenlei_updt",
        },

    difangmeishi:{
        list:"difangmeishi_list.do",
        insert:"difangmeishiinsert.do",
        update:"difangmeishiupdate.do",
        delete:"difangmeishi_delete.do",
        detail:"difangmeishi_detail.do",
        create:"difangmeishi_add.do",
        edit:"difangmeishi_updt.do",
        weblist:"difangmeishilist.do",
        webdetail:"difangmeishidetail.do",
    },
    meishifenlei:{
        list:"meishifenlei_list.do",
        insert:"meishifenleiinsert.do",
        update:"meishifenleiupdate.do",
        delete:"meishifenlei_delete.do",
        detail:"meishifenlei_detail.do",
        create:"meishifenlei_add.do",
        edit:"meishifenlei_updt.do",
    },
    links:{
        list:"youqinglianjie_list.do",
        insert:"youqinglianjieinsert.do",
        update:"youqinglianjieupdate.do",
        delete:"youqinglianjie_delete.do",
        detail:"youqinglianjie_detail.do",
        create:"youqinglianjie_add.do",
        edit:"youqinglianjie_updt.do",
    },
    comment_boards:{
            list:"liuyanban_list.do",
            insert:"liuyanbaninsert.do",
            update:"liuyanbanupdate.do",
            delete:"liuyanban_delete.do",
            detail:"liuyanban_detail.do",
            create:"liuyanban_add.do",
            edit:"liuyanban_updt.do",
            listliuyanren:"liuyanban_list_liuyanren.do",
            webdetail:"liuyanban_webdetail",
        },
    rotate_image:{
            list:"lunbotu_list.do",
            insert:"lunbotuinsert.do",
            update:"lunbotuupdate.do",
            delete:"lunbotu_delete.do",
            detail:"lunbotu_detail.do",
            create:"lunbotu_add.do",
            edit:"lunbotu_updt.do",
        },


    touristRoutes:{
            list:"lvyouxianlu_list",
            insert:"lvyouxianluinsert",
            update:"lvyouxianluupdate",
            delete:"lvyouxianlu_delete",
            detail:"lvyouxianlu_detail",
            create:"lvyouxianlu_add",
            edit:"lvyouxianlu_updt",
            weblist:"lvyouxianlulist",
            webdetail:"lvyouxianludetail",
            weblist_collection:"lvyouxianlulist_collection",
        },
    booking:{
            list:"yuding_list",
            insert:"yudinginsert",
            update:"yudingupdate",
            delete:"yuding_delete",
            detail:"yuding_detail",
            create:"yuding_add",
            edit:"yuding_updt",
            listyudingren:"yuding_list_yudingren",
        },

    }

export default api
